package com.cardbaobao.cardbabyclient.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.cardbaobao.cardbabyclient.R;
import com.cardbaobao.cardbabyclient.buried.Self;
import com.cardbaobao.cardbabyclient.buried.SelfUtils;
import com.cardbaobao.cardbabyclient.model.UserBindCards;
import com.cardbaobao.cardbabyclient.ui.activity.base.BaseActivity;
import com.cardbaobao.cardbabyclient.buried.GoogleAnalyticsUtil;
import com.cardbaobao.cardbabyclient.widget.TitleBar;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by FHW
 * on 2017/11/09 .
 */

public class NewAddCreditCardSuccessActivity extends BaseActivity {
    @BindView(R.id.title_bar)
    TitleBar titleBar;
    private UserBindCards.CreditCard creditCard;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_add_credit_card_success_new;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {

        mCurrentPageId=Self.Page.app_repayment_add_creditCard_success;

        titleBar.setLeftViewOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        creditCard = getIntent().getParcelableExtra("creditCard");
    }

    @Override
    protected void onResume() {
        super.onResume();
        GoogleAnalyticsUtil.setScreenName("信用卡添加成功");
    }

    @OnClick(R.id.bt_repayment)
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_repayment:
                SelfUtils.buriedClickData(Self.Action.app_click_repayment_repay,
                        Self.Action.app_click_repayment_repay_des,
                        mEnterPageTime,
                        mCurrentPageId,
                        mPrePageId);

                Intent intent = new Intent();
                intent.setClass(mContext, NewRepaymentActivity.class);
                intent.putExtra("userName", creditCard.getUser_name());
                intent.putExtra("bankName", creditCard.getCard_type_name());
                intent.putExtra("cardNumber", creditCard.getCredit_card_no());
                intent.putExtra("picUrl", creditCard.getPicture());
                intent.putExtra("cardId", creditCard.getId());
                intent.putExtra(PRE_PAGE_ID_S,mCurrentPageId);
                startActivity(intent);

                finish();
                break;
        }
    }
}
